#include <vector>
#include "TH2F.h"

using namespace std;

int evn, evnNum, runNum, lumiB, bcid, nPV, old_nPV, ngoodVtx, sptype;
unsigned int LArError;
int el_isInDeadFeb, mu_isInDeadFeb, jet_isInDeadFeb, trkjet_isInDeadFeb, smartlarveto;

//....
int nE, nMu, nLep;
std::vector<double> *ptLep = new std::vector<double>;
std::vector<double> *etaLep = new std::vector<double>;
std::vector<double> *phiLep = new std::vector<double>;
std::vector<double> *eLep = new std::vector<double>;
std::vector<double> *clptLep = new std::vector<double>;
std::vector<double> *cletaLep = new std::vector<double>;
std::vector<double> *clphiLep = new std::vector<double>;
std::vector<double> *cleLep = new std::vector<double>;
std::vector<double> *flavLep = new std::vector<double>;
std::vector<double> *expBLHLep = new std::vector<double>;
std::vector<int> *isemMedLep = new std::vector<int>;
std::vector<int> *isemTightLep = new std::vector<int>;
std::vector<int> *robusterTightLep = new std::vector<int>;
std::vector<double> *etconeLep = new std::vector<double>;
std::vector<double> *ptconeLep = new std::vector<double>;
std::vector<double> *trkisoLep = new std::vector<double>;
std::vector<double> *d0Lep = new std::vector<double>;
std::vector<double> *z0Lep = new std::vector<double>;
std::vector<double> *d0sigLep = new std::vector<double>;
std::vector<double> *z0sigLep = new std::vector<double>;
std::vector<double> *dphiLepPtMiss = new std::vector<double>;
std::vector<double> *drJetLep = new std::vector<double>;
std::vector<double> *msptLep = new std::vector<double>;
std::vector<double> *idptLep = new std::vector<double>;
std::vector<int> *npxlLep = new std::vector<int>;
std::vector<int> *nblrLep = new std::vector<int>;
std::vector<int> *nsctLep = new std::vector<int>;
std::vector<int> *ntrtLep = new std::vector<int>;
std::vector<int> *ntrthLep = new std::vector<int>;
std::vector<int> *nmdtLep = new std::vector<int>;
std::vector<int> *nrpcetaLep = new std::vector<int>;
std::vector<int> *ncscetaLep = new std::vector<int>;
std::vector<int> *ntgcetaLep = new std::vector<int>;
std::vector<double> *evwtLep = new std::vector<double>;
std::vector<int> *sigLep = new std::vector<int>;
std::vector<double> *trgwtLep = new std::vector<double>;

////...Truth
int ntrMu;
std::vector<double> *trptMu = new std::vector<double>;
std::vector<double> *tretaMu = new std::vector<double>;
std::vector<double> *trphiMu = new std::vector<double>;
std::vector<double> *trchargeMu = new std::vector<double>;
std::vector<int> *trpdgidMu = new std::vector<int>;
std::vector<int> *trbarcodeMu = new std::vector<int>;
std::vector<int> *trtypeMu = new std::vector<int>;
std::vector<int> *trorigMu = new std::vector<int>;

//.....
int nJet, nbadJet, jetcleanCutA, jetcleanCutB, jetcleanCutC, jetcleanCutD;
std::vector<double> *ptJet = new std::vector<double>;
std::vector<double> *etaJet = new std::vector<double>;
std::vector<double> *phiJet = new std::vector<double>;
std::vector<double> *eJet = new std::vector<double>;
std::vector<double> *mJet = new std::vector<double>;
std::vector<double> *emfJet = new std::vector<double>;
std::vector<double> *emptJet = new std::vector<double>;
std::vector<double> *emetaJet = new std::vector<double>;
std::vector<double> *emphiJet = new std::vector<double>;
std::vector<double> *emeJet = new std::vector<double>;
std::vector<double> *hadptJet = new std::vector<double>;
std::vector<double> *hadetaJet = new std::vector<double>;
std::vector<double> *hadphiJet = new std::vector<double>;
std::vector<double> *hadeJet = new std::vector<double>;
std::vector<double> *jetprob = new std::vector<double>;
std::vector<double> *sv0Jet = new std::vector<double>;
std::vector<int> *isBJet = new std::vector<int>;
std::vector<double> *dphiJetPtMiss = new std::vector<double>;
std::vector<double> *emjesJet = new std::vector<double>;
std::vector<double> *qJet = new std::vector<double>;
std::vector<double> *timeJet = new std::vector<double>;
std::vector<double> *hecfJet = new std::vector<double>;
std::vector<double> *tgap3fJet = new std::vector<double>;
std::vector<double> *fcorJet = new std::vector<double>;

//....
double sign, mLL, dphiLep, drLep, refmT, mJJ, dphiJet, drJet;
double refPtMissX, refPtMissY, refPtMiss, phiRefPtMiss, refSumET, refMeffL, weight, weighto, st, sumptLep;
int etaCrack, otxVeto, zmuveto;
double muonPtMissX, muonPtMissY, muonPtMiss, phiMuonPtMiss, muonSumET;
double lchtopoPtMissX, lchtopoPtMissY, lchtopoPtMiss, philchtopoPtMiss, lchtopoSumET;
double sumpxMuon, sumpyMuon;
double totPtMissX, totPtMissY, totPtMiss, phiTotPtMiss, sumTotPtMiss;
double met_corrDEx, met_corrDEy;

//....
int ef_e15_medium, ef_e10_medium_mu6, ef_e10_medium_mu10, ef_e20_medium, ef_e20_medium1;
int ef_2e12_medium;
int ef_mu13, ef_mu20, ef_mu18, ef_mu15_mu10_EFFS;
int ef_xe20nomu, ef_xe30nomu, ef_xe35nomu, ef_xe40nomu;

//....
double ElePtCut=10.;
double MuoPtCut=10.;
double eleEtaCut=2.47;
double muoEtaCut=2.4;
double jetPtCut=20.;
double jetEtaCut=2.8;
double conesize=0.4;
bool useJetClean=true;
bool doJetOR=true;
bool doEleOR=true;
bool doMuoOR=true;
